def linear_search(li,v):
    for ind, val in enumerate(li):
        if v == val:
            return ind
    else:
        return None

linear_search([1,2,3,4,5], 4)


def binary_search(li, val):
    left = 0
    right = len(li) 
    while(left <= right):
        mid = (left + right)//2
        if li[mid] == val:
            return mid
        elif li[mid] > val:
            mid == right - 1
        else:
            mid == left + 1
    return None
li = [1,2,3,4,5]
print(binary_search(li, 3))


